'''
测试一个经典GUI程序的写法，使用面向对象的方式
'''

from tkinter import *
from tkinter import messagebox

class Application(Frame):

    def __init__(self,master=None):
        super().__init__(master)
        self.master=master
        self.pack()
        self.createEidget()

    def createEidget(self):

        #文字
        self.label01 = Label(self,text= "百战程序员",width=10,height=2,bg='blue',font=("黑体",30))
        self.label01.pack()

        #图片 # 需要将photo声明全局变量
        global  photo
        photo = PhotoImage(file = "./link.png")
        self.label03 = Label(self,image=photo)
        self.label03.pack()



if __name__ == '__main__':
    root = Tk()
    root.geometry("600x500+200+300")
    app = Application(master=root)
    root.mainloop()